/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.schedule.core.repository.mapper;

import info.peigen.hotpot.common.core.enums.YesOrNo;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlMapper;
import info.peigen.hotpot.component.schedule.core.repository.entity.ScheduleNodeEntity;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

import java.util.List;

/**
 * <b>(ScheduleNodeMapper)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/12/28
 */
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
public interface ScheduleNodeMapper extends AbstractBeetlSqlMapper<ScheduleNodeEntity> {
    @Sql("select * from schedule_node where node_name = ?")
    @Select
    ScheduleNodeEntity findByNodeName(String nodeName);

    @Sql("select * from schedule_node where ip = ?")
    @Select
    ScheduleNodeEntity findByIp(String ip);

    @Sql("select * from schedule_node where yesOrNo = ?")
    @Select
    List<ScheduleNodeEntity> findByEnable(YesOrNo yesOrNo);

    @Sql("delete from schedule_node where node_name = ?")
    @Update
    void deleteByNodeName(String nodeName);
}